{% extends "base.html" %}
{% block title %}礼包分红详情列表{% end %}
{% block content %}
<div class="pace  pace-inactive">
    <div class="pace-progress" data-progress-text="100%" data-progress="99" style="width: 100%;">
        <div class="pace-progress-inner"></div>
    </div>
    <div class="pace-activity"></div>
</div>
<div id="wrapper">
    {% include 'admin_nav.html' %}
    <div id="page-wrapper" class="gray-bg dashbard-1">
        <div class="row border-bottom">
            {% include 'header_nav.html' %}
        </div>
        <div class="row wrapper border-bottom white-bg page-heading">
            <div class="col-lg-10">
                <h2>管理奖列表</h2>
                <ol class="breadcrumb">
                    <li>
                        <a href="/admin/home">主页</a>
                    </li>
                    <li>
                        <a href="/admin/userlist">用户管理</a>
                    </li>
                    <li>
                        <strong>管理奖列表</strong>
                    </li>
                </ol>
            </div>
            <div class="col-lg-2">

            </div>
        </div>
        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-lg-12">


                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <div class="row">
                                <form action="" method="get" id="search">
                                    {% module xsrf_form_html() %}
                                    <div class="input-group">
                                        <input type="text" placeholder="查找用户,会员编号/手机号" value="{{search}}"
                                               name="search" class="input form-control">
                                        <span class="input-group-btn">
                                                <button type="submit" class="btn btn btn-primary"><i
                                                        class="fa fa-search"></i>
                                                    搜索
                                                </button>
                                        </span>
                                    </div>
                                </form>
                            </div>
                            <div class="ibox-tools">
                                <a class="collapse-link">
                                    <i class="fa fa-chevron-up"></i>
                                </a>


                                <a class="close-link">
                                    <i class="fa fa-times"></i>
                                </a>
                            </div>
                        </div>
                        <div class="ibox-content">
                            <style>
                                th:first-child,
                                .gradeX td:first-child {
                                    width: 20px;
                                    cursor: pointer;
                                }

                                th:first-child input,
                                .gradeX td:first-child input {
                                    cursor: pointer;
                                }
                            </style>
                            <form action="javascript:;" method="post" name="login_form" id="login_form">
                                {% module xsrf_form_html() %}
                                <table class="table table-striped table-bordered table-hover dataTables-example">
                                    <thead>
                                    <tr>
                                        <th><input type="checkbox" class="i-checks" id="userListCheck"/></th>
                                        <th>奖金编号</th>
                                        <th>用户</th>
                                        <th>奖金金额</th>
                                        <th>发放时间</th>

                                    </tr>
                                    </thead>
                                    <tbody>
                                    {% for r in record %}
                                    <tr class="gradeX">
                                        <td><input type="checkbox" class="i-checks"></td>
                                        <td class="userListId">{{ r.get('id','无') }}</td>
                                        <td>{{r.get('uid','')}}</td>
                                        <td>{{ r.get('money','') }}</td>
                                        <td>{{r.get('time')}}</td>

                                    </tr>
                                    {% end %}
                                    </tbody>
                                </table>
                                <div class="row">
                                    <div class="col-sm-12">
                                        <div class="dataTables_info" id="DataTables_Table_0_info" role="alert"
                                             aria-live="polite" aria-relevant="all">第{{current_page}}页/总共{{pages}}页
                                            总共{{counts}}条 每页50条
                                        </div>
                                    </div>
                                    <div class="col-sm-12">
                                        <div class="dataTables_paginate paging_simple_numbers"
                                             id="DataTables_Table_0_paginate">
                                            <ul class="pagination">
                                                <!--<li class="paginate_button previous disabled"-->
                                                <!--aria-controls="DataTables_Table_0" tabindex="0"-->
                                                <!--id="DataTables_Table_0_previous"><a href="#">上一页</a></li>-->
                                                {% if pages>1 %}
                                                {% for p in range(1,pages+1) %}
                                                <li class="paginate_button {%if current_page==p%}active{%end%}"
                                                    aria-controls="DataTables_Table_0"
                                                    tabindex="0"><a href="?page={{p}}">{{ p }}</a></li>
                                                {% end %}
                                                {% end %}


                                                <!--<li class="paginate_button next" aria-controls="DataTables_Table_0"-->
                                                <!--tabindex="0" id="DataTables_Table_0_next"><a href="#">下一页</a></li>-->
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                                <input type="button" class="btn btn-w-m btn-primary delete1" value="删除选中"
                                       data-toggle="modal" data-target="#myModal5" disabled/>
                                <!--<input type="button" class="btn btn-w-m btn-primary audit1" value="拉入黑名单"-->
                                <!--data-toggle="modal" data-target="#myModal6" disabled/>-->

                                <div class="modal inmodal fade" id="myModal5" tabindex="-1" role="dialog"
                                     aria-hidden="true">
                                    <div class="modal-dialog modal-lg">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button type="button" class="close" data-dismiss="modal"><span
                                                        aria-hidden="true">&times;</span><span
                                                        class="sr-only">Close</span></button>
                                                <h4 class="modal-title">删除</h4>
                                                {#
                                                <small class="font-bold">删除</small>
                                                #}
                                            </div>
                                            <div class="modal-body">
                                                <p class="delete1Content"></p>
                                            </div>

                                            <div class="modal-footer">
                                                <button type="button" class="btn btn-white deleteUserId"
                                                        data-dismiss="modal">确定
                                                </button>
                                                <button type="button" class="btn btn-primary" data-dismiss="modal">取消
                                                </button>
                                            </div>
                                        </div>
                                    </div>
                                </div>


                            </form>

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>


    $(function () {


        var json1 = _alert('.btn.btn-w-m.delete1', '.modal-body .delete1Content', '您要删除的ID为');

        var list_to_handle;

        $('tr.gradeX input[type="checkbox"],#userListCheck').click(function () {
            list_to_handle = listNubmer();
            console.log(listNubmer());
        });

        function getCookie(name) {
            var r = document.cookie.match("\\b" + name + "=([^;]*)\\b");
            return r ? r[1] : undefined;
        }

        $.ajaxSetup({
            beforeSend: function (xhr, settings) {
                if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type)) {
                    xhr.setRequestHeader("X-XSRFToken", getCookie("_xsrf"));
                }
            }
        });

        $('.btn.btn-white.deleteUserId').click(function () {
            $.ajax({
                url: '/admin/manage_award',
                type: 'delete',
                data: list_to_handle,
                success: function (data) {
                    console.log(data);
                },
                error: function () {
                    alert('error');
                }
            });
        });



    });
</script>

{% end %}